import globals from 'globals';
import pluginJs from '@eslint/js';
import prettierPlugin from 'eslint-plugin-prettier';

export default [
  { files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
  { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
  pluginJs.configs.recommended,
  {
    rules: {
      'no-unused-vars': ['warn', { vars: 'all', args: 'none' }],
      'prettier/prettier': 'error',
    },
  },
  // 使用 Prettier 插件
  {
    plugins: {
      prettier: prettierPlugin,
    },
    rules: {
      // 合并 Prettier 的推荐配置
      'prettier/prettier': 'error',
    },
  },
];
